package vn.easyticket.db.entity;

import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Table( name = "M062_WEB_USER_IN_ROLES" )
public class M062_WebUserInRoles
    extends AbstractEntity
{
    @EmbeddedId
    protected M062_WebUserInRolesPK webUserInRolesPK;

    public M062_WebUserInRoles()
    {
    }

    public M062_WebUserInRoles( M062_WebUserInRolesPK webUserInRolesPK )
    {
        this.webUserInRolesPK = webUserInRolesPK;
    }

    public M062_WebUserInRoles( int userId, int roleId )
    {
        this.webUserInRolesPK = new M062_WebUserInRolesPK( userId, roleId );
    }

    public M062_WebUserInRolesPK getWebUserInRolesPK()
    {
        return webUserInRolesPK;
    }

    public void setWebUserInRolesPK( M062_WebUserInRolesPK webUserInRolesPK )
    {
        this.webUserInRolesPK = webUserInRolesPK;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += ( webUserInRolesPK != null ? webUserInRolesPK.hashCode() : 0 );
        return hash;
    }

    @Override
    public boolean equals( Object object )
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if ( !( object instanceof M062_WebUserInRoles ) )
        {
            return false;
        }
        M062_WebUserInRoles other = (M062_WebUserInRoles) object;
        if ( ( this.webUserInRolesPK == null && other.webUserInRolesPK != null )
            || ( this.webUserInRolesPK != null && !this.webUserInRolesPK.equals( other.webUserInRolesPK ) ) )
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Easyticket.dbo.[M062_WEB_USER_IN_ROLES][ webUserInRolesPK=" + webUserInRolesPK + " ]";
    }

}
